package com.zw.design.pattern.creational.structural.composite;

import java.math.BigDecimal;

/****
 * 课程类
 */
public class Course extends  CatalogComponent{

    private String name;
    private BigDecimal price;

    public Course(String name, BigDecimal price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String  getName(CatalogComponent catalogComponent) {
        return  this.name;
    }

    @Override
    public BigDecimal getPrice(CatalogComponent catalogComponent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println("catalogComponent =名字 " + name +" 价格 "+ price+"");
    }
}
